package org.rbreznak.tronco.client;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class KeyboardTestScreen extends Screen{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private JLabel statusText = new JLabel();

	private KeyboardPanel keyboard = new KeyboardPanel();
	
	public KeyboardTestScreen() {
		setLayout(new BorderLayout());
		setBackground(new Color(0,0,0));
		
		FormatUI.formatLabel(statusText);
		
		add(statusText, BorderLayout.NORTH);
		add(keyboard, BorderLayout.SOUTH);
		
		keyboard.addKeyListener(this);
		
		this.addKeyListener(this);
		
		this.setVisible(true);
	}
	
	public void actionPerformed(ActionEvent arg0) {

	}

	public void keyPressed(KeyEvent e) {	

	}

	public void keyReleased(KeyEvent e) {

	}

	public void keyTyped(KeyEvent e) {
		statusText.setText(statusText.getText() + e.getKeyChar());
	}

	@Override
	public void decideNext() {
		if(nodes.size() > 0) {
			setNext(nodes.get(0));
		}
	}
	
	@Override
	public String toString() {
		return statusText.getText();
	}

	@Override
	public void reset() {
		setNext(null);
	}
}
